package com.lanhe.admin.controller.identifier;


import com.lanhe.common.annotation.Log;
import com.lanhe.common.core.controller.BaseController;
import com.lanhe.common.core.domain.AjaxResult;
import com.lanhe.common.core.page.TableDataInfo;
import com.lanhe.common.enums.BusinessType;
import com.lanhe.identifier.domain.LhIdentifierBindLog;
import com.lanhe.identifier.service.ILhIdentifierBindLogService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 识别码（绑定）日志(LhIdentifierBindLog)表控制层
 *
 * @author zhanggl
 * @since 2023-09-19 09:45:41
 */
@RestController
@RequestMapping("lhIdentifierBindLog")
public class LhIdentifierBindLogController extends BaseController {

    /**
     * 服务对象
     */
    @Resource
    private ILhIdentifierBindLogService lhIdentifierBindLogService;


    /**
     * 分页查询所有数据
     */
    @PreAuthorize("@ss.hasPermi('identifier:lhIdentifierBindLog:list')")
    @GetMapping("/list")
    public TableDataInfo list(LhIdentifierBindLog identifierBindLog) {
        startPage();
        List<LhIdentifierBindLog> list = lhIdentifierBindLogService.selectIdentifierBindLogList(identifierBindLog);
        return getDataTable(list);
    }

    /**
     * 根据编号获取详细信息
     */
    @PreAuthorize("@ss.hasPermi('identifier:lhIdentifierBindLog:query')")
    @GetMapping(value = { "/", "/{identifierBindLogId}" })
    public AjaxResult getInfo(@PathVariable(value = "identifierBindLogId") Long identifierBindLogId)
    {
        return success(lhIdentifierBindLogService.selectIdentifierBindLogById(identifierBindLogId));
    }


    /**
     * 添加识别码绑定日志
     */
    @PreAuthorize("@ss.hasPermi('identifier:lhIdentifierBindLog:add')")
    @Log(title = "识别码绑定日志管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@Validated @RequestBody LhIdentifierBindLog identifierBindLog)
    {
        identifierBindLog.setCreateBy(getUsername());
        return toAjax(lhIdentifierBindLogService.insertIdentifierBindLog(identifierBindLog));
    }
}

